package memento;

import lombok.Data;

/**
 * 原始对象
 */
@Data
public class Originator {
    private String state = "原始对象";
    private String id;
    private String name;
    private String phone;

    //创建备忘录对象
    public Memento create(){
        return new Memento(id,name,phone);
    }

    //从备忘录对象恢复
    public void restore(Memento memento){
        this.id = memento.getId();
        this.name = memento.getName();
        this.phone = memento.getPhone();
    }
}
